package Method;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.*;

import Model.*;

public class getCompany {

	/**
	 * @param args
	 * @return 
	 * @return 
	 * @throws ClassNotFoundException 
	 * @throws SQLException 
	 */public getCompany() throws SQLException, ClassNotFoundException{
		 Vector<Company> Companys = new Vector<Company>() ;
			String sql = "select * from company" ;
			ResultSet rs = DataConnect.getStatement().executeQuery(sql);
			while(rs.next()){
				Companys.add(new Company(rs.getInt(1),rs.getString(2)));
			}
				String name = null;
				for(int i = 0;i<Companys.size();i++){
					
					name = Companys.get(i).getDepartment();
					System.out.println(name);
				}
				
	 }
	 
	public static void main(String[] args) throws SQLException, ClassNotFoundException {
		// TODO Auto-generated method stub

		new getCompany();
	}
}
